﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using CuaHangLaptop.DAL;

namespace CuaHangLaptop.BIZ
{
    public class Laptop_BIZ
    {
        int id;
        string maLaptop;
        string tenLaptop;
        NhaSX_BIZ nhaSX = new NhaSX_BIZ();
        string cpu;
        string ram;
        string hdd;
        string vga;
        string monitor;
        string baohanh;
        string thongtin;
        string img;

        public string IMG
        {
            get { return img; }
            set { img = value; }
        }
        decimal gia;

        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        public string MaLaptop
        {
            get { return maLaptop; }
            set { maLaptop = value; }
        }

        public string TenLaptop
        {
            get { return tenLaptop; }
            set { tenLaptop = value; }
        }

        public NhaSX_BIZ NhaSX
        {
            get { return nhaSX; }
            set { nhaSX = value; }
        }

        public string TenNSX
        {
            get { return NhaSX.TenNSX; }
        }

        public string Cpu
        {
            get { return cpu; }
            set { cpu = value; }
        }        

        public string Ram
        {
            get { return ram; }
            set { ram = value; }
        }        

        public string Hdd
        {
            get { return hdd; }
            set { hdd = value; }
        }        

        public string Vga
        {
            get { return vga; }
            set { vga = value; }
        }        

        public string Monitor
        {
            get { return monitor; }
            set { monitor = value; }
        }        

        public string Baohanh
        {
            get { return baohanh; }
            set { baohanh = value; }
        }        

        public string Thongtin
        {
            get { return thongtin; }
            set { thongtin = value; }
        }        

        public decimal Gia
        {
            get { return gia; }
            set { gia = value; }
        }

        public Laptop_BIZ()
        {
        }

        public Laptop_BIZ(int _id, string malt, string nsx, string tenlp, string cpu, string ram, string hdd, string vga, string monitor, string bh, string thongtin, string _img, decimal gia)
        {
            id = _id;
            maLaptop = malt;
            tenLaptop = tenlp;
            nhaSX = nhaSX.Get_NSX_ByCode(nsx);
            this.cpu = cpu;
            this.ram = ram;
            this.vga = vga;
            this.hdd = hdd;
            this.monitor = monitor;
            baohanh = bh;
            this.thongtin = thongtin;
            img = _img;
            this.gia = gia;
        }

        public List<Laptop_BIZ> GetAll_Laptop_ByNSX(string _mansx)
        {
            return Laptop_DAL.GetAll_LapTop_ByNSX(_mansx);
        }

        public Laptop_BIZ Get_Laptop_ByCode(string _MaLaptop)
        {
            return Laptop_DAL.Get_LapTop_ByCode(_MaLaptop);
        }

        public List<Laptop_BIZ> GetAll_Laptop()
        {
            return Laptop_DAL.GetAll_LapTop();
        }

        public int Get_Lasted_ID()
        {
            return Laptop_DAL.Get_Lasted_ID();
        }

        public void Save()
        {
            if (id == -1) id = Laptop_DAL.Insert(this);
            else Laptop_DAL.Update(this);
        }

        public void Delete()
        {
            Laptop_DAL.Delete(this);
        }
    }
}
